﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    <Style TargetType="{x:Type Slider}">
        <Setter Property="Background" Value="{DynamicResource SliderTrackBackgroundThemeBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource SliderBorderThemeBrush}" />
        <Setter Property="BorderThickness" Value="{DynamicResource SliderBorderThemeThickness}" />
        <Setter Property="Foreground" Value="{DynamicResource SliderTrackDecreaseBackgroundThemeBrush}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Slider}">
                    <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                        <Grid>
                            <Grid.Resources>
                                <Style TargetType="Thumb" x:Key="SliderThumbStyle">
                                    <Setter Property="BorderThickness" Value="1" />
                                    <Setter Property="BorderBrush" Value="{DynamicResource SliderThumbBorderThemeBrush}" />
                                    <Setter Property="Background" Value="{DynamicResource SliderThumbBackgroundThemeBrush}" />
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="Thumb">
                                                <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </Grid.Resources>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <TickBar x:Name="TopTick" Fill="{DynamicResource ResourceKey=SliderTickmarkOutsideBackgroundThemeBrush}" Height="{DynamicResource ResourceKey=SliderOutsideTickBarThemeHeight}" Margin="0,0,0,2" Placement="Top" Grid.Row="0" Visibility="Collapsed" />
                            <TickBar x:Name="BottomTick" Fill="{DynamicResource SliderTickmarkOutsideBackgroundThemeBrush}" Height="{DynamicResource SliderOutsideTickBarThemeHeight}" Margin="0,2,0,0" Placement="Bottom" Grid.Row="2" Visibility="Collapsed" />
                            <Track x:Name="PART_Track" Grid.Row="1">
                                <Track.DecreaseRepeatButton>
                                    <RepeatButton x:Name="HorizontalDecrease" Command="Slider.DecreaseLarge" Background="{TemplateBinding Foreground}">
                                        <RepeatButton.Style>
                                            <Style TargetType="{x:Type RepeatButton}">
                                                <Setter Property="OverridesDefaultStyle" Value="True" />
                                                <Setter Property="Focusable" Value="False" />
                                                <Setter Property="IsTabStop" Value="False" />
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                            <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" />
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </RepeatButton.Style>
                                    </RepeatButton>
                                </Track.DecreaseRepeatButton>
                                <Track.IncreaseRepeatButton>
                                    <RepeatButton x:Name="HorizontalIncrease" Command="Slider.IncreaseLarge" Background="Transparent">
                                        <RepeatButton.Style>
                                            <Style TargetType="{x:Type RepeatButton}">
                                                <Setter Property="OverridesDefaultStyle" Value="True" />
                                                <Setter Property="Focusable" Value="False" />
                                                <Setter Property="IsTabStop" Value="False" />
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                            <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" />
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </RepeatButton.Style>
                                    </RepeatButton>
                                </Track.IncreaseRepeatButton>
                                <Track.Thumb>
                                    <Thumb x:Name="Thumb" Background="{DynamicResource SliderThumbBackgroundThemeBrush}" Style="{DynamicResource SliderThumbStyle}" DataContext="{TemplateBinding Value}" Width="{DynamicResource SliderTrackThemeHeight}" Height="{DynamicResource SliderTrackThemeHeight}" OverridesDefaultStyle="True" VerticalAlignment="Center" />
                                </Track.Thumb>
                            </Track>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="HorizontalDecrease" Property="Background" Value="{DynamicResource SliderTrackDecreasePointerOverBackgroundThemeBrush}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="HorizontalDecrease" Property="Background" Value="{DynamicResource SliderTrackDecreaseDisabledBackgroundThemeBrush}" />
                        </Trigger>
                        <Trigger SourceName="HorizontalDecrease" Property="IsPressed" Value="True">
                            <Setter TargetName="HorizontalDecrease" Property="Background" Value="{DynamicResource SliderTrackDecreasePressedBackgroundThemeBrush}" />
                            <Setter Property="Background" Value="{DynamicResource SliderTrackPressedBackgroundThemeBrush}" />
                        </Trigger>
                        <Trigger SourceName="HorizontalIncrease" Property="IsPressed" Value="True">
                            <Setter TargetName="HorizontalDecrease" Property="Background" Value="{DynamicResource SliderTrackDecreasePressedBackgroundThemeBrush}" />
                            <Setter Property="Background" Value="{DynamicResource SliderTrackPressedBackgroundThemeBrush}" />
                        </Trigger>
                        <Trigger SourceName="Thumb" Property="IsDragging" Value="True">
                            <Setter TargetName="HorizontalDecrease" Property="Background" Value="{DynamicResource SliderTrackDecreasePressedBackgroundThemeBrush}" />
                            <Setter Property="Background" Value="{DynamicResource SliderTrackPressedBackgroundThemeBrush}" />
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="True">
                            <Setter TargetName="HorizontalDecrease"  Property="Background" Value="{DynamicResource ControlValidationInvalidThemeBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource SliderTrackPointerOverBackgroundThemeBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Background" Value="{DynamicResource SliderTrackDisabledBackgroundThemeBrush}" />
            </Trigger>
            <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Slider}">
                            <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                <Grid>
                                    <Grid.Resources>
                                        <Style TargetType="Thumb" x:Key="SliderThumbStyle">
                                            <Setter Property="BorderThickness" Value="1" />
                                            <Setter Property="BorderBrush" Value="{DynamicResource SliderThumbBorderThemeBrush}" />
                                            <Setter Property="Background" Value="{DynamicResource SliderThumbBackgroundThemeBrush}" />
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="Thumb">
                                                        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </Grid.Resources>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" MinWidth="{TemplateBinding MinHeight}" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TickBar x:Name="TopTick" Fill="{DynamicResource ResourceKey=SliderTickmarkOutsideBackgroundThemeBrush}" Height="{DynamicResource ResourceKey=SliderOutsideTickBarThemeHeight}" Margin="0,0,0,2" Placement="Top" Grid.Row="0" Visibility="Collapsed" />
                                    <TickBar x:Name="BottomTick" Fill="{DynamicResource SliderTickmarkOutsideBackgroundThemeBrush}" Height="{DynamicResource SliderOutsideTickBarThemeHeight}" Margin="0,2,0,0" Placement="Bottom" Grid.Row="2" Visibility="Collapsed" />
                                    <Track x:Name="PART_Track" Grid.Row="1">
                                        <Track.DecreaseRepeatButton>
                                            <RepeatButton x:Name="VerticalDecrease" Command="Slider.DecreaseLarge" Background="{TemplateBinding Foreground}">
                                                <RepeatButton.Style>
                                                    <Style TargetType="{x:Type RepeatButton}">
                                                        <Setter Property="OverridesDefaultStyle" Value="True" />
                                                        <Setter Property="Focusable" Value="False" />
                                                        <Setter Property="IsTabStop" Value="False" />
                                                        <Setter Property="Template">
                                                            <Setter.Value>
                                                                <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                    <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" />
                                                                </ControlTemplate>
                                                            </Setter.Value>
                                                        </Setter>
                                                    </Style>
                                                </RepeatButton.Style>
                                            </RepeatButton>
                                        </Track.DecreaseRepeatButton>
                                        <Track.IncreaseRepeatButton>
                                            <RepeatButton x:Name="VerticalIncrease" Command="Slider.IncreaseLarge" Background="Transparent">
                                                <RepeatButton.Style>
                                                    <Style TargetType="{x:Type RepeatButton}">
                                                        <Setter Property="OverridesDefaultStyle" Value="True" />
                                                        <Setter Property="Focusable" Value="False" />
                                                        <Setter Property="IsTabStop" Value="False" />
                                                        <Setter Property="Template">
                                                            <Setter.Value>
                                                                <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                    <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" />
                                                                </ControlTemplate>
                                                            </Setter.Value>
                                                        </Setter>
                                                    </Style>
                                                </RepeatButton.Style>
                                            </RepeatButton>
                                        </Track.IncreaseRepeatButton>
                                        <Track.Thumb>
                                            <Thumb x:Name="Thumb" Background="{DynamicResource SliderThumbBackgroundThemeBrush}" Style="{DynamicResource SliderThumbStyle}" DataContext="{TemplateBinding Value}" Width="{DynamicResource SliderTrackThemeHeight}" Height="{DynamicResource SliderTrackThemeHeight}" OverridesDefaultStyle="True" VerticalAlignment="Center" />
                                        </Track.Thumb>
                                    </Track>
                                </Grid>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter TargetName="VerticalDecrease" Property="Background" Value="{DynamicResource SliderTrackDecreasePointerOverBackgroundThemeBrush}" />
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter TargetName="VerticalDecrease" Property="Background" Value="{DynamicResource SliderTrackDecreaseDisabledBackgroundThemeBrush}" />
                                </Trigger>
                                <Trigger SourceName="VerticalDecrease" Property="IsPressed" Value="True">
                                    <Setter TargetName="VerticalDecrease" Property="Background" Value="{DynamicResource SliderTrackDecreasePressedBackgroundThemeBrush}" />
                                    <Setter Property="Background" Value="{DynamicResource SliderTrackPressedBackgroundThemeBrush}" />
                                </Trigger>
                                <Trigger SourceName="VerticalIncrease" Property="IsPressed" Value="True">
                                    <Setter TargetName="VerticalDecrease" Property="Background" Value="{DynamicResource SliderTrackDecreasePressedBackgroundThemeBrush}" />
                                    <Setter Property="Background" Value="{DynamicResource SliderTrackPressedBackgroundThemeBrush}" />
                                </Trigger>
                                <Trigger SourceName="Thumb" Property="IsDragging" Value="True">
                                    <Setter TargetName="VerticalDecrease" Property="Background" Value="{DynamicResource SliderTrackDecreasePressedBackgroundThemeBrush}" />
                                    <Setter Property="Background" Value="{DynamicResource SliderTrackPressedBackgroundThemeBrush}" />
                                </Trigger>
                                <Trigger Property="Validation.HasError" Value="True">
                                    <Setter TargetName="VerticalDecrease"  Property="Background" Value="{DynamicResource ControlValidationInvalidThemeBrush}" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>